<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>常见问题类型列表</title>
		<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/app.css" />
		<style>
			*{
				border: 0px;
				margin: 0px;
				padding: 0px;
				font-family: "黑体";	
			}
			
			#serachprotype{
				position: fixed;
				width: 100%;
				height: 40px;
				top: 10px;
				background-color: #fafafa;
			}
		</style>
	</head>
	<body style="background-color: white;">
		<div id="serachprotype" style="">
			<input type="search" placeholder="Search" style="height: 30px; background-color: white; font-size: 17px;"/>
		</div>
		<div class="mui-content" style="background-color: white;">
			<div id="rfcproblemtypelst" class="mui-scroll-wrapper" style="height: 92%; top: 60px;">
				<div class="mui-scroll">
					<div id="problemTypelst">
						<!--
                        	作者：xuzhao_deng@sina.com
                        	时间：2017-01-09
                        	描述：常见问题类型列表
                        -->
					</div>
				</div>
			</div>
		</div>
	</body>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/utils/http.utils.js"></script>
	<script>
		var $orgId = localStorage.getItem("wxfwid");
		var $currpage = 0;
		mui.init({
			pullRefresh: {
				container: "#rfcproblemtypelst",
				up: {
					height: 20,
					auto: true,
					deceleration: 0.0006 ,
					contentrefresh : "加载中...",
					contentnomore:'没有更多数据了',
					callback: loadprobTypeLstDat
				}
			}
		});
		
		function loadprobTypeLstDat(){
			getProbTypeLstDat(8, $currpage);
		}
		
		function getProbTypeLstDat($psize, $cpage){
			mui.ajax({
				url : $request_url.getBigComProLst,
				type : "get",
				headers: {
					"Authorization": $headers_authorization
				},
				dataType : "json",
				data : {
					orgId : $orgId
				}, 
				success : function(dat){
					if(dat.code == 0){
						var $result = dat.result;
						if($result != null && $result != ""){
							$currpage ++;
							if($currpage == 1){
								mui("#rfcproblemtypelst").pullRefresh().endPullupToRefresh(false);
								var $resDoc = document.getElementById("problemTypelst");
								for(var i = 0; i < $result.length; i ++){
									var $div = document.createElement("div");
									$div.innerHTML = problemTypeLstTem($result[i], i);
									$resDoc.appendChild($div);
								}
							} else {
								mui("#rfcproblemtypelst").pullRefresh().endPullupToRefresh(true);
							}
						} else {
							mui("#rfcproblemtypelst").pullRefresh().endPullupToRefresh(true);
						}
					} else {
						mui.toast(dat.message);
						return;
					}
				}, error : function(err){
					mui.toast("服务繁忙...");
					return;
				}
			});
		}
		
		function problemTypeLstTem($info, $num){
			var $proTypeHtml = 
			'<a href="problemlst.html?procode='+ $info.code +'">'
			+	'<div style="display: flex; margin-top: 5px;">'
			+		'<div style="width: 22%; margin: 4px;">'
			+			'<img src="'+ $info.imagePath +'" style="width: 100%; height: 80px;" />'
			+		'</div>'
			+		'<div style="width: 72%; margin-left: 4px;">'
			+			'<span style="color: #303030; font-size: 15px;">'+ $info.title +'</span>'
			+			'<span style="display: block; color: #616161; font-size: 13px; margin-top: 2px;">'+ $info.description +'</span>'
			+			'<span style="display: block; color: #909090; font-size: 12px; margin-top: 4px;">'+ $info.faqNum +'个问题</span>'
			+		'</div>'
			+		'<div style="width: 6%; margin: auto 0px auto 0px; float: right;">'
			+			'<img src="../../img/right.png" />'
			+		'</div>'
			+	'</div>'
			+'</a>'
			+'<div style="margin-top: 5px;">'
			+	'<hr class="levline" />'
			+'</div>';
			return $proTypeHtml;
		}
		
		mui("#problemTypelst").on("tap", "a", function(){
			mui.openWindow({
				url : this.href
			});
		});
	</script>
</html>
